<template>
  <div>
    <PresonalFrom @handleRequest="handleRequest"></PresonalFrom>
  </div>
</template>
<script>
import { POST } from "../../Network/Request";

import { PresonalFrom } from "../../components/index.js";
export default {
  name: "PresonalAdd",
  components: {
    PresonalFrom
  },
  methods: {
    // 子组件传递过来的数据
    async handleRequest(data) {
      let res = await POST("api/personal/persinalAdd", data);
      if (res.data.code === 1) {
        this.$message({
          message: res.data.msg,
          type: "success"
        });
        // 延时跳转
        setTimeout(() => {
          this.$router.push("/personal");
        }, 1000);
      } else {
        this.$message({
          message: res.data.msg,
          type: "warning"
        });
      }
    }
  }
};
</script>
<style lang='less'>
</style>